<template >
 <el-table :data="tableData" style="width: 100%" height="800">
    <el-table-column fixed prop="userid" label="用户ID" width="120" />
    <el-table-column prop="username" label="用户名" width="100" />
    <el-table-column prop="password" label="密码" width="80" />
    <el-table-column prop="tel" label="电话号" width="120" />
    <el-table-column prop="telcode" label="电话编码" width="120" />
    <el-table-column prop="email" label="邮件" width="120" />
    <el-table-column prop="nickname" label="昵称" width="120" />
    <el-table-column prop="qq" label="QQ" width="120" />
    <el-table-column prop="wx" label="微信" width="120" />
    <el-table-column prop="avatar" label="化身" width="120" />
    <el-table-column prop="sex" label="性别" width="120" />
    <el-table-column prop="birthday" label="生日" width="120" />
    <el-table-column prop="createTime" label="创建时间" width="120" />
    <el-pagination background layout="prev, pager, next" :total="1000"  @current-change ="changepage"/>
  </el-table>
</template>
<script setup>
import { computed,onMounted ,ref } from 'vue'
import { getUser1} from '@/api/user1.js'
// import { useRouter } from 'vue-router'
const loading = ref(true)
const tableData = ref([])
const page = ref([])
const addressData = computed(() =>
  tableData.value.filter(
    (data,index) =>
      index<10
  )
)
console.log(addressData);
const getaddress =  onMounted(async () => {
  let res = await getUser1('/user/list')
  // console.log(res)
  if (res.code == '200') {
    page.value = res.data
    tableData.value = res.data.slice(0,10)
    loading.value = false
  }
})
getUser1()
const changepage = (index) =>{
  tableData.value=page.value.slice((index-1)*10,(index-1)*10+10)
}

</script>
<style lang="">
  
</style>